package com.shop.Control;

import com.JSON2.json.JSONObject;
import com.opensymphony.xwork2.ActionContext;
import com.shop.service.MemberServiceImpl;
import com.shop.util.BeanUtil;
/**
 * 
 * <b>初始化主页<b>
 * @author 威 
 * <br>2018年1月10日 下午6:40:03 
 *
 */
public class InitIndexAction extends SuperActionSupport{
	private static final long serialVersionUID = 1L;
	
	public MemberServiceImpl getService(){
		return (MemberServiceImpl) BeanUtil.getBean("memberServiceImpl"); 
	}
	/**
	 * 初始化首页
	 * <p>	 
	 * @return
	 * String
	 * @see
	 * @since 1.0
	 */
	public String initPage() {
		Integer id = (Integer) ActionContext.getContext().getSession().get("member_id");
		System.out.println("初始化开始,id - " + id);
		if(id != null) {
			JSONObject object = new JSONObject();
			object.put("car", getService().getCar(id));
			object.put("colle", getService().getColle(id));
			object.put("foot", getService().getFoot(id));
			object.put("infor", getService().getInfor(id));
			System.out.println(object.toString());
			print(object.toString());
		}else print("false");
		return SUCCESS;
	}
	/**
	 * 在首页点击进入店铺
	 * <p>	 
	 * @return
	 * String
	 * @see
	 * @since 1.0
	 */
	public String clickToMerchant(){
		print("234");
		return SUCCESS;
	}
}